package chixing.day09.work;

public class OrderManger {
    private static int totalOrders = 0;

    // 静态方法，打印订单摘要
    public static void printSummary(Order o) {
        System.out.println("===== 订单摘要 =====");
        System.out.println("订单ID: " + o.getOrderId());
        System.out.println("订单类型: " + o.getOrderType());
        System.out.println("商品总价: " + o.getOrderPrice() + "元");

        // 如果是在线订单，显示配送费
        if (o instanceof OnlineOrder) {
            System.out.println("配送费用: " + ((OnlineOrder) o).getDeliveryFee() + "元");
        }

        System.out.println("订单总计: " + o.calculateTotal() + "元");
        System.out.println("===================");
        System.out.println();
    }

    // 增加订单计数
    public static void incrementOrderCount() {
        totalOrders++;
    }

    // 获取订单总数
    public static int getTotalOrders() {
        return totalOrders;
    }
}
